package jltx.fragmentpageframework.simple.fragment.home;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import jltx.fragmentpageframework.R;
import jltx.fragmentpageframework.simple.fragment.base.BaseMainFragment;

/**
 * @author jltxseo
 *         Created by junlintianxia on 2017/05/16.
 */

public class HomeFragment extends BaseMainFragment {
    private final String TAG = HomeFragment.class.getSimpleName();

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_simple_home,container,false);
        if(savedInstanceState == null){
            FragmentTAB1 fragmentTAB1 = new FragmentTAB1();
            loadRootFragment(R.id.fragment_home_container,fragmentTAB1);
        }
        setToolbarTitle(R.string.btn_activity_enter_simple);
        return rootView;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
    }

    @Override
    public void onLazyInitView(@Nullable Bundle savedInstanceState) {
        super.onLazyInitView(savedInstanceState);
    }

    @Override
    public boolean onBackPressedSupport() {
        if(super.onBackPressedSupport()){
            return true;
        }else if (getChildFragmentManager().getBackStackEntryCount() > 1) {
            popChild();
            return true;
        } else {
            return false;
        }
    }
}
